package app.caihan.wanandroid.ui.wxarticle

import app.caihan.wanandroid.R
import app.caihan.wanandroid.databinding.ItemChapterItemBinding
import app.caihan.wanandroid.model.bean.Article
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder


class ChapterListAdapter : BaseQuickAdapter<Article, BaseDataBindingHolder<ItemChapterItemBinding>>(
    R.layout.item_chapter_item) {
    override fun convert(holder: BaseDataBindingHolder<ItemChapterItemBinding>, item: Article) {
        // 获取 Binding
        val binding: ItemChapterItemBinding? = holder.dataBinding

        //let 操作符,如果对象的值不为空，则允许执行这个方法等同于if(binding != null),it表示他自己
        binding?.let {
            it.itemObj = item
            it.executePendingBindings()
        }
    }
}